<% layout('/layouts/default.html', {title: '广告主管理', libs: ['validate','fileupload']}){ %>
<div class="main-content">
    <div class="box box-main">
        <div class="box-header with-border">
            <div class="box-title">
                <i class="fa fa-list-alt"></i> ${text(adVertiser.isNewRecord ? '新增广告主' : '编辑广告主')}
            </div>
            <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                </button>
            </div>
        </div>
        <#form:form id="inputForm" model="${adVertiser}" action="${ctx}/ad/adVertiser/save" method="post"
        class="form-horizontal">
        <div class="box-body">
            <div class="form-unit">${text('基本信息')}</div>
            <#form:hidden path="id"/>
            <div class="row">
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required">*</span> ${text('广告主账户')}：<i
                                class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <% if(adVertiser.id != null){ %>
                            <#form:input path="account" maxlength="200" class="form-control required" readonly="true"/>
                            <% } %>
                            <% if(adVertiser.id == null){ %>
                            <#form:input path="account" minlength="4" maxlength="200"
                            class="form-control required userName"
                            remote="${ctx}/ad/adVertiser/checkAccount?oldAccount=${adVertiser.account}"
                            data-msg-remote="${text('广告主账户已存在')}"/>
                            <% } %>
                        </div>
                    </div>
                </div>
				<div class="col-xs-6">
					<div class="form-group">
						<label class="control-label col-sm-4" title="">
							<span class="required hide">*</span> ${text('行业分类')}：<i class="fa icon-question hide"></i></label>
						<div class="col-sm-8">
							<#form:treeselect id="industryCode" title="${text('行业分类选择')}"
								path="industryCode.industryCode" labelPath="industryCode.industryName"
								url="${ctx}/ad/adIndustryType/treeData"
								class="" allowClear="true" canSelectParent="true" canSelectRoot="true"/>
						</div>
					</div>
				</div>
            </div>
            <div class="row">
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required">*</span> ${text('账户邮箱')}：<i
                                class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="email" maxlength="255" class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required">*</span> ${text('账户密码')}：<i
                                class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="password" maxlength="255" class="form-control"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('联系人')}：<i
                                class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="contact" maxlength="10" class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('联系电话')}：<i
                                class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="mobile" maxlength="20" class="form-control"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('公司名称')}：<i
                                class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="companyName" maxlength="50" class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('公司官网')}：<i
                                class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="companyWebsite" maxlength="255" class="form-control"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row" hidden>
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2">${text('图片上传')}：</label>
                        <div class="col-sm-10">
                            <#form:fileupload id="uploadImage" bizKey="${adVertiser.id}" bizType="adVertiser_image"
                            uploadType="image" class="" readonly="false"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2">${text('营业执照')}：</label>
                        <div class="col-sm-10">
                            <#form:fileupload id="uploadFile1" bizKey="${adVertiser.id}" bizType="adVertiser_YYZZ"
                            uploadType="all" class="" readonly="false"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2">${text('ICP证书')}：</label>
                        <div class="col-sm-10">
                            <#form:fileupload id="uploadFile2" bizKey="${adVertiser.id}" bizType="adVertiser_ICP"
                            uploadType="all" class="" readonly="false"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2">${text('其他资质证书')}：</label>
                        <div class="col-sm-10">
                            <#form:fileupload id="uploadFile3" bizKey="${adVertiser.id}" bizType="adVertiser_otherFile"
                            uploadType="all" class="" readonly="false"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-footer">
            <div class="row">
                <div class="col-sm-offset-2 col-sm-10">
                    <% if (hasPermi('ad:adVertiser:edit')){ %>
                    <button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i>
                        ${text('保 存')}
                    </button>&nbsp;
                    <% } %>
                    <button type="button" class="btn btn-sm btn-default" id="btnCancel"
                            onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}
                    </button>
                </div>
            </div>
        </div>
    </#form:form>
</div>
</div>
<% } %>
<script>
    $("#inputForm").validate({
        submitHandler: function (form) {
            js.ajaxSubmitForm($(form), function (data) {
                js.showMessage(data.message);
                if (data.result == Global.TRUE) {
                    js.closeCurrentTabPage(function (contentWindow) {
                        contentWindow.page();
                    });
                }
            }, "json");
        }
    });
</script>